I think the condition here was slightly off from before, so invert it subtly to
get what we want, lifting up anything in a workspace or binaries otherwise.
Closes #3432
map.insert(crate_type.to_string(), Some((prefix.to_string(), suffix.to_string())));
}
-
+
let cfg = if has_cfg {
Some(try!(lines.map(Cfg::from_str).collect()))
} else {
// we don't want to link it up.
if src_dir.ends_with("deps") {
// Don't lift up library dependencies
- if self.ws.members().find(|&p| p != unit.pkg).is_some() && !unit.target.is_bin() {
+ if self.ws.members().find(|&p| p == unit.pkg).is_none() &&
+ !unit.target.is_bin() {
None
} else {
Some((
version required: *
"));
}
+
+#[test]
+fn workspace_produces_rlib() {
+ let p = project("foo")
+ .file("Cargo.toml", r#"
+ [project]
+ name = "top"
+ version = "0.5.0"
+ authors = []
+
+ [workspace]
+
+ [dependencies]
+ foo = { path = "foo" }
+ "#)
+ .file("src/lib.rs", "")
+ .file("foo/Cargo.toml", r#"
+ [project]
+ name = "foo"
+ version = "0.5.0"
+ authors = []
+ "#)
+ .file("foo/src/lib.rs", "");
+ p.build();
+
+ assert_that(p.cargo("build"), execs().with_status(0));
+
+ assert_that(&p.root().join("target/debug/libtop.rlib"), existing_file());
+ assert_that(&p.root().join("target/debug/libfoo.rlib"), existing_file());
+
+}